import service from "@/utils/http";


/* 获取分类标签配置 */
export const getTagCate = () => {
    return service({
        method:"GET",
        url:"/upload/config"
    })
}


// 推送文章
export const pushArticle = (articleInfo:any) => {
    return service({
        url: "/article/create",
        method:"POST",
        data:articleInfo
    })
}

/**
 * @description 获取文章列表
 * @param page 页码
 * @param  pageSize 每页条数
 * @param cateId 当前分类id 不传送表示全部
 * */

export const getArticleList = (page:number|string,pageSize:number|string,cateId?:string|number) => {
    let url = cateId ? `/article/list?page=${page}&pageSize=${pageSize}`
        :
        `/article/list?page=${page}&pageSize=${pageSize}&cateId=${cateId}`
    return service({
        method:"GET",
        url
    })
}

// 删除文章
export const deleteArticle = (id:number|string) => {
    return service({
      method:"DELETE",
      url:`/article/delete/${id}`  
    })
}
